package cn.smart.epic.core.log;

import java.util.TimerTask;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @Auther Uncle_Z
 * @date 2017/9/25 23:21
 * @Email:2545375@qq.com
 * @Descrition 日志管理器
 * @since 1.0
 */

public class LogManager {

    //日志操作 延迟
    private final int OPERATE_DELAY_TIME = 10;

    //异步操作记录日志的线程池
    private ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(10);

    private LogManager(){}

    public static LogManager logManager = new LogManager();

    public static LogManager me(){
        return logManager;
    }

    public void executeLog(TimerTask task){
        executor.schedule(task,OPERATE_DELAY_TIME, TimeUnit.MILLISECONDS);
    }

}
